<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>replaceChild(newnode,oldnew)</title>
</head>
<body>


<div><b id="oldnode">JavaScript</b>是一个很常用的技术，为网页添加动态效果。</div>
<a href="javascript:replaceMessage()"> 将加粗改为斜体</a>

<script type="text/javascript">
    function replaceMessage() {
        //补充函数 replaceMessage() 代码，实现将 b 标签替换成 i 标签。
        //alert("hello");
        var newnode = document.createElement("i");
        var newnodeText = document.createTextNode("JavaScript");
        newnode.appendChild(newnodeText);
        var oldnode = document.getElementById('oldnode');
        oldnode.parentNode.replaceChild(newnode, oldnode);
    }
</script>

</body>
</html>